package com.xl.yygh.task.scheduled;

import com.xl.yygh.common.constant.MqConst;
import com.xl.yygh.common.service.RabbitService;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/**
 * @author XiangLiang
 * @date 2023/11/16 16:26
 * @description
 */
@Component
@EnableScheduling
public class ScheduledTask {
    @Resource
    private RabbitService rabbitService;

    /**
     * 每天8点执行 提醒就诊
     * cron = "0 0 1 * * ?"才是每天8点，现测试启用为每30秒发送一次
     */
    @Scheduled(cron = "0/30 * * * * ?")
    public void taskPatientTip() {
        rabbitService.sendMessage(MqConst.EXCHANGE_DIRECT_TASK, MqConst.ROUTING_TASK_8, "");
    }

}
